package com.ogawa.musicmodule;

import com.ogawa.base.utils.ACacheUtils;
import com.ogawa.musicmodule.bean.PlayMainMusicEvent;

import static com.ogawa.musicmodule.MusicServiceKt.MUSIC_SERVER_STATUS_SUSPEND;

public class MusicProjectSpUtils {
    //保存最后一个脑波音乐
    static private String MUSIC_MAIN_LAST_NAME = "MUSIC_MAIN_LAST_NAME";
    //保存音乐定时时间
    static private String SAVE_MUSIC_ALL_TIME = "SAVE_MUSIC_ALL_TIME";
    //------------------保存最后一个脑波音乐------------------//
    public static PlayMainMusicEvent getMusicLastName() {
        return (PlayMainMusicEvent) ACacheUtils.getObject(MUSIC_MAIN_LAST_NAME, new PlayMainMusicEvent("","",MUSIC_SERVER_STATUS_SUSPEND));
    }

    public static void setMusicLastName(PlayMainMusicEvent last) {
        PlayMainMusicEvent saveEvent = new PlayMainMusicEvent(last.getTitle(),last.getPath(),MUSIC_SERVER_STATUS_SUSPEND);
        saveEvent.setVolume(last.getVolume());
        ACacheUtils.putObject(MUSIC_MAIN_LAST_NAME,saveEvent);
    }


    /**
     * 获取音乐定时时长     分钟
     * @return
     */
    public static float getMusicAllTime(){
        return ACacheUtils.getFloat(SAVE_MUSIC_ALL_TIME, 10*60f);
    }

    public static void setMusicAllTime(float minTime){
        ACacheUtils.putFloat(SAVE_MUSIC_ALL_TIME, minTime);
    }



}
